package gen;

public class DirectiveListener extends CalBaseListener {

    @Override
    public void exitPrintExpr(CalParser.PrintExprContext ctx) {
        System.out.println("RET");
    }

    @Override
    public void exitAssign(CalParser.AssignContext ctx) {
        String id = ctx.ID().getText();
        System.out.println("STR " + id );
    }

    @Override
    public void exitMulDiv(CalParser.MulDivContext ctx) {
        if (ctx.op.getType() == CalParser.MUL) {
            System.out.println("MUL");
        } else {
            System.out.println("DIV");
        }
    }

    @Override
    public void exitAddSub(CalParser.AddSubContext ctx) {
        if (ctx.op.getType() == CalParser.ADD) {
            System.out.println("ADD");
        } else {
            System.out.println("SUB");
        }
    }
}